﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MVCTippSpielManagement.Management.Structs;
using System.Data;
using System.Data.SqlClient;

namespace MVCTippSpielManagement.Management
{
	public class User
	{

		// Usermanagement
		protected UserManagement _UserManagement;

		//Table: Benutzer
		protected int _ID;
		protected string _Username;
		protected string _Firstname;
		protected string _Surname;
		protected DateTime _BirthDate;
		protected string _EMail;
		protected string _Password;
		protected int _SecretQuestionID;
		protected string _SecretQuestionAnswer;
		protected string _State;

		//Table Anschrift
		protected Dictionary<string, Address> _Address;
		
		//Table: BenutzerBenutzergruppe
		protected Dictionary<int, string> _UserGroups;

		
		#region Konstruktor
		public User()
		{
			//Default Konstruktor
			UserManagement _UserManagement = new UserManagement();
		}
		
		public User(DataRow _dataRow)
        {
			UserManagement _UserManagement = new UserManagement();
			this.Populate(_dataRow);
        }


		#endregion 

		#region Protected Methods
	
		protected virtual void Populate(DataRow BenutzerDataRow)
		{
	
	
		}


		protected virtual void ReadUserInformations()
		{
			//Reads the user 
			
		}

		protected virtual void ReadUserAdresses()
		{
			_Address = _UserManagement.GetUserAddress(ID);

		}

		protected virtual void ReadUserGroups() 
		{
			_UserGroups = _UserManagement.GetUserGroups(ID);
		}
		
		#endregion

		#region Public Methods

		public bool Save()
		{
			//Speichert User in der Datenbank und gibt True bei erfolg
			return true;
		}

		#endregion

		#region -> Get and Set Method

		public int ID
		{
			get { return _ID;}
			set
			{_ID = value;}
		}

		public string Username
		{
			get { return _Username; }
			set
			{ _Username = value; }
		}

		public string Firstname
		{
			get { return _Firstname; }
			set
			{ _Firstname = value; }
		}

		public string Surname
		{
			get { return _Surname; }
			set
			{ _Surname = value; }
		}

		public DateTime BirthDate
		{
			get { return _BirthDate; }
			set
			{ _BirthDate = value; }
		}

		public string EMail
		{
			get { return _EMail; }
			set
			{ _EMail = value; }
		}

		public string Password
		{
			get { return _Password; }
			set
			{ _Password = value; }
		}

		public int SecretQuestionID
		{
			get { return _SecretQuestionID; }
			set
			{ _SecretQuestionID = value; }
		}

		public string SecretQuestionAnswer
		{
			get { return _SecretQuestionAnswer; }
			set
			{ _SecretQuestionAnswer = value; }
		}

		public string State
		{
			get { return _State; }
			set
			{ _State = value; }
		}

		public Dictionary<int, string> UserGroups
		{
			get { return _UserGroups; }
			set
			{ _UserGroups = value; }
		}

		#endregion
		
	}
}
